<%@ page language="java" contentType="text/html; charset=UTF-8"
         pageEncoding="UTF-8"%>
<%@taglib prefix="mvc" uri="http://www.springframework.org/tags/form" %>
<%@taglib prefix="fmt" uri="http://www.springframework.org/tags" %>
<%
    String path = request.getContextPath();
    String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>

<!DOCTYPE html>
<html>
<head lang="en">
    <meta charset="UTF-8">
    <title>资质证书管理新建</title>
    <link rel="stylesheet" type="text/css" href="../../lib/pagination/style/pagination.css"/>
    <link rel="stylesheet" type="text/css" href="../../css/base.css"/>
    <link rel="stylesheet" type="text/css" href="../../css/news/center.css"/>
    <link rel="stylesheet" href="/lib/laydate/need/laydate.css">
    <link rel="stylesheet" href="/lib/layui/layui/css/layui.css?20190817.1">
    <script type="text/javascript" src="../../js/news/jquery-1.9.1.js"></script>
    <script src="/lib/laydate/laydate.js"></script>
    <script type="text/javascript" src="/js/base/tablePage.js"></script>
    <script src="../../js/news/page.js"></script>
    <script src="../../js/base/base.js" type="text/javascript" charset="utf-8"></script>
    <script src="../../lib/pagination/js/jquery.pagination.min.js" type="text/javascript" charset="utf-8"></script>
    <script src="../../lib/layer/layer.js?20201106"></script>
    <script src="../../lib/laydate/laydate.js"></script>
    <script src="../js/sys/citys.js" type="text/javascript" charset="utf-8"></script>
    <script src="/lib/layui/layui/layui.js"></script>
    <script src="/lib/jQuery-File-Upload-master/jquery.ui.widget.js" type="text/javascript" charset="utf-8"></script>
    <script src="/lib/jQuery-File-Upload-master/jquery.iframe-transport.js" type="text/javascript" charset="utf-8"></script>
    <script src="/lib/jQuery-File-Upload-master/jquery.fileupload.js" type="text/javascript" charset="utf-8"></script>
    <style>
        * {font-family: "Microsoft Yahei" !important;}
        b{
            color: red;
        }
        .head_title{
            margin-top: 10px;
            height: 40px;
            position: relative;
        }
        .head_title .title{
            margin-left: 22px;
        }
        .head_title span{
            float: none;
            /*margin-top: 9px;*/
            font-size: 22px;
            color: #333;
            display: inline-block;
            margin-left: 10px;
            vertical-align: middle;
            margin-top: -6px;
        }
        .saveBtn{
            display: block;
            float: left;
            background: url(../img/confirm.png) no-repeat;
            border: none;
            width: 70px;
            height: 29px;
            line-height: 29px;
            margin-left: 10px;
            cursor: pointer;
        }
        .resetBtn {
            display: block;
            float: left;
            background: url(../img/news/new_filling.png) no-repeat;
            border: none;
            width: 70px;
            height: 29px;
            line-height: 29px;
            margin-left: 10px;
            cursor: pointer;
        }
        .div_Btn{
            position: absolute;
            left: 43%;
            margin: 10px auto;
        }
        select{
            width: 250px;
            height: 30px;
        }
        .newTbale tr td {
            border-right: #ccc 1px solid;
            /*padding: 5px 30px;*/
        }
        input[type="text"]{
            width: 80%;
            height: 30px;
        }
        .newTbale {
            width: 85%;
            margin: 0px auto;
        }
        table {
            border-collapse: collapse;
            border-spacing: 0;
        }
        #ajaxforms{
            position: relative;
        }
        input[type="file"]{
            width: 80%;
        }
        .addCl{
            padding: 0 12px;
            background: royalblue;
            display: inline-block;
            position: relative;
            top: 3px;
            color: white;
        }
        .attachmentId input[type=file]{
            position: absolute;
            top: 0;
            right: 0;
            bottom: 0;
            left: 0;
            width: 100%;
            height: 18px;
            z-index: 99;
            opacity: 0;
        }
        .addTd{
            padding: 0;
            text-align: center;
        }
        .addTd input{
            width: 90%;
        }
        .addTd td{
            padding: 4px;
        }
    </style>
    <link rel="stylesheet" type="text/css" href="/css/commonTheme/${sessionScope.InterfaceModel}/commonTheme.css"/>
</head>
<body>
<%--弹出层--%>
<div class="newAdd" style="margin: 3% auto;" id="addFrame">
    <div id="pagediv layui-form">
        <form id="ajaxforms" action="/crmCertificate/insetCertificate" autocomplete="off">
            <table class="newTbale layui-table addEit" lay-filter="test">
                <tr style="background: #e5e5e5;">
                    <td colspan="4" style="font-size: 16px;font-weight: bold;">法人信息维护</td>
                </tr>
                <tr>
                    <td class="biwI" title="法人">法人:</td>
                    <td><input type="text" name="lawName" /><b>*</b></td>
                    <td class="biwI" title="联系人电话（手机）">联系人电话（手机）:</td>
                    <td><input type="text" name="contactPerson"/><b>*</b></td>
                </tr>
                <tr>
                    <td class="biwI" title="联系人电话（座机）">联系人电话（座机）:</td>
                    <td><input type="text" name="phone" /></td>
                    <td class="biwI" title="电子邮件">电子邮件:</td>
                    <td><input type="text" name="email" /><b>*</b></td>
                </tr>
                <tr>
                    <td class="biwI" title="相关专业">相关专业:</td>
                    <td><input type="text" name="profession" /><b>*</b></td>
                    <td class="biwI" title="成立时间">成立时间:</td>

                    <td> <input name="createTime" type="text" class="" id="test2" placeholder="yyyy-MM-dd 00:00:00"><b>*</b></td>
                </tr>
                <tr>
                    <td class="biwI" title="所在地区" type='hide' >所在地区:</td>
                    <td>
                        <select name="province"  style="width: 40%" id="sheng">
                            <option class="sheng">请选择</option>
                        </select>
                        <select name="city" style="width: 39%" id="city1"  >
                            <option>请选择</option>
                        </select><b>*</b>
                    </td>
                    <td class="biwI" title="地址详情">地址详情:</td>
                    <td><input type="text" name="address" /><b>*</b></td>

                </tr>
                <tr>
                    <td class="biwI" title="合同编号">合同编号:</td>
                    <td><input type="text" name="contractNo" class="required  contractNo"  />
                        </td>
                    <td>备注:</td>
                    <td><input type="text" name="remark"/></td>
                </tr>
                <tr style="background: #e5e5e5;">
                    <td class="biwI" name="colspan" colspan="4" style="text-align: right;">
                    <span colspan="4" style="font-size: 16px;font-weight: bold;display: inline-block; float: left; margin-top: 7px;">法人证书管理</span>
                        <button name="plus" type="button" class="layui-btn layui-btn-normal  layui-btn-sm"><i class="layui-icon layui-icon-addition"></i> </button>
                        <%--<button name="plus" type="button" class="layui-btn layui-btn-normal  layui-btn-sm" style="border-radius: 5px">上传 </button>--%>
                    </td>
                </tr>
                <tr>
                    <td class="biwI" colspan="4" style="text-align: right;">
                        <div id="planTableDiv" class="layui-card-body">
                            <form action="" id="planTi">
                            <table class="layui-hide" id="plan" lay-filter="plan"></table>
                            </form>
                        </div>
                    </td>
                </tr>
                <tr role="2">
                    <td colspan="4" style="text-align: center;">
                        <button type="button" class="layui-btn layui-btn-normal baocun"  style="width: 100px; border-radius: 6px;">保存</button>
                        <button type="button" class="layui-btn layui-btn-normal backFan"  style="width: 100px; border-radius: 6px;">返回</button>
                    </td>
                </tr>
            </table>
        </form>
    </div>
</div>
<script type="text/html" id="planDel">
    {{#  if( isEdit == 'true' ){ }}
    <a class="layui-btn layui-btn-danger layui-btn-xs del2" lay-event="del2">删除</a>
    {{#  } }}
    <a class="layui-btn  layui-btn-xs del2 layui-btn-warm deImgs" lay-event="fileNameBut">删除附件</a>
<%--    <a class="layui-btn  layui-btn-xs del2 layui-btn-warm" lay-event="fileNameBut">删除附件</a>--%>
</script>
<script type="text/html"  id="planFu">
    <button type="button" class="layui-btn layui-btn-xs" lay-event="planFu1">
        <i class="layui-icon">&#xe67c;</i>
    </button>
</script>
</body>
<%--新建--%>
<script>


    function getQueryString(name){
        var reg = new RegExp("(^|&)"+ name +"=([^&]*)(&|$)");
        var r = window.location.search.substr(1).match(reg);
        if(r!=null)return  unescape(r[2]); return null;
    }

    var certId = getQueryString("certId");
    var isEdit = getQueryString("isEdit");
    var editXia = getQueryString('editXia')
    var menu = getQueryString('menu')
    if(menu == 1){
        $('.backFan').hide()
    }
    if(menu == 1){
        var isEdit = 'true'
    }

    var $,laydate,upload,table;
    var idfile,index2;
    var tablePlus = [{
        certName: ""
        ,certNo: ''
        ,certNumber: ""
        ,certStartTime: ""
        ,certEndTime: ""
        ,remindTime: ''
        ,attachmentName: ''
        ,attachmentId: ''
    }]

    var cols = [[
        {field:'certName', title: '证件照名称', edit:true , align : 'center'}
        ,{field:'certNo', title: '证件照编号' , edit:true, align : 'center'}
        ,{field:'certNumber', title: '证件号码' ,edit:true, align : 'center'}
        ,{field:'certStartTime', title: '开始时间' , event: 'certStartTime' , align : 'center'}
        ,{field:'certEndTime', title: '截止时间' , event: 'certEndTime' , align : 'center'}
        ,{field:'remindTime', title: '提醒时间', event:'remind', align : 'center'}
        ,{field:'attachmentName', title: '附件',event:'enclosure', align : 'center', templet : function(d){
                return '<form class="layui-form" action="">' +
                    '  <button type="button"  class="layui-btn layui-btn-xs butfile" name = "butfile" id="'+d.LAY_TABLE_INDEX+'"  >\n' +
                    '      <i class="layui-icon" >&#xe67c;</i>\n' +
                    '   </button>' +
                    '<span id="fileName' + d. LAY_TABLE_INDEX+ '" class="fileName"  style="display: inline;">' +
                    function (){
                        return d.attachmentName;
                    }() +
                    '</span>' +
                    '</form>';
            }}
        ,{title: '操作',toolbar: '#planDel', align : 'center'}
    ]]

    //加号按钮
    $('button[name="plus"]').click(function () {
        var plan = layui.table.cache["plan"];
        plan.push({
            certName: ""
            ,certNo: ''
            ,certNumber: ""
            ,certStartTime: ""
            ,certEndTime: ""
            ,remindTime: ''
            ,attachmentName: ''
            ,attachmentId: ''
        });
        table.reload('plan', {
            data: plan
        });
    });

    //新建数据
    var affrimFormat = function(){
        var plan = layui.table.cache["plan"];
        // console.log(plan)
        var arr = [];
        for (var i = 0; i < plan.length ; i++) {
            plan[i]["lawName"] = $('input[name="lawName"]').val();
            plan[i]["contactPerson"] = $('input[name="contactPerson"]').val();
            plan[i]["phone"] = $('input[name="phone"]').val();
            plan[i]["email"] = $('input[name="email"]').val();
            plan[i]["profession"] = $('input[name="profession"]').val();
            plan[i]["createTime"] = $('input[name="createTime"]').val();
            plan[i]["province"] = $('select[name="province"]').val();
            plan[i]["city"] = $('select[name="city"]').val();
            plan[i]["address"] = $('input[name="address"]').val();
            plan[i]["contractNo"] = $('input[name="contractNo"]').val();
            plan[i]["remark"] = $('input[name="remark"]').val();

            arr.push(plan[i]);
        }
        return arr;
    }
    $('.backFan').click(function(){
        window.location.href='/supplier/certification';
    })

    $('.baocun').click(function () {

        var arr = affrimFormat()
        var arrAnd = {json:JSON.stringify(arr)}

        var url = '/crmCertificate/insetCertificate'
        if(certId != null){
            url = '/crmCertificate/updateByPrimaryKey'
            arr[0].certId = certId
            var arrEdit = arr[0]
           arrAnd = {
               certName:arrEdit.certName,
               certNo:arrEdit.certNo,
               certNumber:arrEdit.certNumber,
               certStartTime:arrEdit.certStartTime,
               certEndTime:arrEdit.certEndTime,
               remindTime:arrEdit.remindTime,
               attachmentName:arrEdit.attachmentName,
               attachmentId:arrEdit.attachmentId,
               LAY_TABLE_INDEX:arrEdit.LAY_TABLE_INDEX,
               lawName:arrEdit.lawName,
               contactPerson:arrEdit.contactPerson,
               phone:arrEdit.phone,

               email:arrEdit.email,
               profession:arrEdit.profession,
               createTime:arrEdit.createTime,
               province:arrEdit.province,
               city:arrEdit.city,
               address:arrEdit.address,
               contractNo:arrEdit.contractNo,
               remark:arrEdit.remark,
               certId:arrEdit.certId,

           }
        }
        for(var i=0;i<arr.length;i++){
            var email=arr[i].email;
            var phone=arr[i].contactPerson;
            var bo = /^\w+((-\w+)|(\.\w+))*\@[A-Za-z0-9]+((\.|-)[A-Za-z0-9]+)*\.[A-Za-z0-9]+$/.test(email);
            var bo1 = !(/^1[3456789]\d{9}$/).test(phone);
            if(arr[i].lawName == '' ){
                layer.msg('请输入法人！', {icon: 2,time:1000});
                return false;

            }else if(bo1 == true){
                layer.msg('请输入正确的联系电话！', {icon: 2,time:1000});
                return false;

            }else if(bo == false){
                layer.msg('请输入正确的邮箱！', {icon: 2,time:1000});
                return false;

            }else if(arr[i].profession == ''){
                layer.msg('请输入相关专业！', {icon: 2,time:1000});
                return false;

            }else if(arr[i].createTime == ''){
                layer.msg('请选择成立时间！', {icon: 2,time:1000});
                return false;

            }else if(arr[i].province == ''){
                layer.msg('请选择省！', {icon: 2,time:1000});
                return false;

            }else if(arr[i].city == ''){
                layer.msg('请选择市！', {icon: 2,time:1000});
                return false;

            }else if(arr[i].address == ''){
                layer.msg('请输入地址详情！', {icon: 2,time:1000});
                return false;

            }else if(arr[i].certName == ''){
                layer.msg('请输入证件号名称！', {icon: 2,time:1000});
                return false;

            }else if(arr[i].certNo == ''){
                layer.msg('请输入证件编号！', {icon: 2,time:1000});
                return false;

            }else if(arr[i].certStartTime == ''){
                layer.msg('请选择证件照起始时间！', {icon: 2,time:1000});
                return false;

            }else if(arr[i].certEndTime == ''){
                layer.msg('请选择证件照截止时间！', {icon: 2,time:1000});
                return false;

            }else if(arr[i].remindTime == ''){
                layer.msg('请选择提醒时间！', {icon: 2,time:1000});
                return false;
            }
        }
        $.ajax({
            url:url,
            dataType:'json',
            type:'post',
            data:arrAnd,
            success: function (data) {
                if(menu == 1){
                    window.location.href='/supplier/newAdd?menu=1';
                }else {
                    window.location.href='/supplier/certification';
                }

                // layer.close(index);//关闭子页面
                // table.reload('pagediv')
            }
        })
    })

    $(function () {
        var duanxin='';
        var flag=0;
        var sheng='<option value="">请选择</option>';
        for(var i=0;i<json.provinces.length;i++){
            sheng+='<option value="'+json.provinces[i].name+'">'+json.provinces[i].name+'</option>'
        }
        $('#sheng').html(sheng);
        $('#sheng').change(function () {
            var prov=$(this).val();
            var citys='<option value="">请选择</option>';
            for(var i=0;i<json.provinces.length;i++){
                if (json.provinces[i].name==prov){
                    if(json.provinces[i].citys!=''&&json.provinces[i].citys!=undefined){
                        for(var j=0;j<json.provinces[i].citys.length;j++){
                            citys+='<option value="'+json.provinces[i].citys[j]+'">'+json.provinces[i].citys[j]+'</option>'
                        }
                    }
                }
            }
            $('#city1').html(citys);
        });

        //编辑回显
        if ( certId != null ){
            $('td[name="colspan"]').hide();
            if(editXia == 2){
                $('.baocun').hide()
            }
            $.ajax({
                type: 'get',
                url: '/crmCertificate/selectByCertificates',
                dataType: 'json',
                async : false,
                data:{
                    certId:certId,
                },
                success: function (res){
                    var data = res.obj[0];
                    $("input[name='lawName']").val(data.lawName)
                    $("input[name='contactPerson']").val(data.contactPerson)
                    $("input[name='email']").val(data.email)
                    $("input[name='profession']").val(data.profession)
                    $("select[name='province']").val(data.province)
                    $("select[name='city'] option:selected").html(data.city)
                    $("select[name='city'] option:selected").val(data.province)
                    $("input[name='address']").val(data.address)
                    $("input[name='contractNo']").val(data.contractNo)
                    $("input[name='remark']").val(data.remark)
                    $("input[name='supplierUser']").val(data.supplierUser)
                    $("input[name='createTime']").val(data.createTime)
                    $("input[name='phone']").val(data.phone)
                    $('.saveBtn').attr('certId',data.certId)

                    //表格数据
                    tablePlus[0]['certName'] = data.certName
                    tablePlus[0]['certNo'] = data.certNo
                    tablePlus[0]['certNumber'] = data.certNumber
                    tablePlus[0]['certStartTime'] = data.certStartTime
                    tablePlus[0]['certEndTime'] = data.certEndTime
                    tablePlus[0]['remindTime'] = data.remindTime
                    tablePlus[0]['attachmentName'] = data.attachmentName
                    tablePlus[0]['attachmentId'] = data.attachmentId

                    //设置列头    删除操作列                    ,
                    cols[0].splice(7,1);

                }
            })
        }

        layui.use(['table','laydate','upload'], function() {
            $ = layui.jquery,
                laydate = layui.laydate
                ,upload = layui.upload
                ,table = layui.table;

            //日期时间选择器
            laydate.render({
                elem: '#test2'
                ,type: 'datetime'
            });

            //渲染表格
             table.render({
                elem: '#plan'
                ,data : tablePlus
                ,cellMinWidth: 80
                ,page : false
                ,cols: cols
                ,done: function(doneres, curr, count){
                     // console.log(tablePlus[0].LAY_TABLE_INDEX)
                     if(tablePlus[0].LAY_TABLE_INDEX !=0){
                         for(var i = 0;i<doneres.data.length;i++){
                             // console.log(tablePlus[0].LAY_TABLE_INDEX-1)
                             doneres.data[tablePlus[0].LAY_TABLE_INDEX-1].attachmentName = ''
                             doneres.data[tablePlus[0].LAY_TABLE_INDEX-1].attachmentId = ''
                             $('#fileName' + index2).html('');
                             // $('#fileName' + tablePlus[0].LAY_TABLE_INDEX).html('')
                             // console.log($('#fileName' + tablePlus[0].LAY_TABLE_INDEX).html(''))
                             }
                         }
                    upload.render({
                        elem: 'button[name="butfile"]'
                        ,url:'../upload?module=crmCertificate'
                        ,accept:'file'
                        , multiple: true
                        , done: function (res,index,file) {
                            var data =res.obj[0];
                            //回显
                            var fileExtension=data.attachName.substring(data.attachName.lastIndexOf(".")+1,data.attachName.length);//截取附件文件后缀
                            var attName = encodeURI(data.attachName).replace(/\+/g, "%2b").replace(/\@/g,"%40").replace(/\#/g,"%23").replace(/\&/g,"%26").replace(/\//g,"%2F").replace(/\?/g,"%3F").replace(/\￥/g,"%ef%bf%a5").replace(/\$/g,"%24").replace(/\！/g,"%ef%bc%81").replace(/\（/g,"%ef%bc%88").replace(/\）/g,"%ef%bc%89").replace(/\…/g,"%e2%80%a6%e2%80%a6");
                            var fileExtensionName=attName.substring(0,attName.lastIndexOf("."));
                            var deUrl = data.attUrl.split('&ATTACHMENT_NAME=')[0]+"&ATTACHMENT_NAME="+fileExtensionName+"."+fileExtension+"&FILESIZE="+data.size;

                            var str = '<span class="dech" deUrl="' + deUrl+ '">' +
                                '<a href="/download?'+encodeURI(deUrl)+'" NAME="' + data.attachName + '*" style="text-decoration:none;margin-left:5px;">' +
                                '<img src="/img/attachment_icon.png"/>' + data.attachName + '</a>' +
                                // '<img class="deImgs" style="margin-left:5px;cursor: pointer;" src="/img/file/icon_deletecha_03.png"/>' +
                                '<input type="hidden" class="inHidden" value="' + data.aid + '@' + data.ym + '_' + data.attachId + ',">' +
                                '<span/>'

                            // $('#fileName' + idfile).append( data.attachName + "*");
                            $('#fileName' + idfile).append(str);

                            //存放数据
                            doneres['data'][idfile].attachmentName += data.attachName + '*';
                            doneres['data'][idfile].attachmentId += data.attachId + ',';

                            // if(){
                            //
                            // }
                        }
                    });
                }
            });
            // 删除附件
            // $(document).on('click', '.deImgs', function () {
            //     var _this = this;
            //     var attUrl = $(this).parents('.dech').attr('deUrl');
            //     layer.confirm('确定删除该附件吗？', function (index) {
            //         $.ajax({
            //             type: 'get',
            //             url: '/delete?' + attUrl,
            //             dataType: 'json',
            //             success: function (res) {
            //                 if (res.flag == true) {
            //                     layer.msg('删除成功', {icon: 6, time: 1000});
            //                     console.log($(_this).parent())
            //                     console.log($(_this).html())
            //                     $(_this).parent().remove();
            //                 } else {
            //                     layer.msg('删除失败', {icon: 2, time: 1000});
            //                 }
            //             }
            //         })
            //     });
            // });

            //表格监听工具事件
            table.on('tool(plan)', function(obj){
                var data = obj.data;
                var layEvent = obj.event;
                var tr = obj.tr;


                if(layEvent === 'certStartTime'){ //起始时间
                    var field = $(this).data('field');
                    var index = tr.attr("data-index");
                    laydate.render({
                        elem: this.firstChild
                        ,type: 'datetime'
                        , done: function (value, date) {
                            table.cache["plan"][index][field] = value
                        }
                    });
                }else if(layEvent === 'certEndTime'){ //截止时间
                    var field = $(this).data('field');
                    var index = tr.attr("data-index");
                    laydate.render({
                        elem: this.firstChild
                        ,type: 'datetime'
                        , done: function (value, date) {
                            table.cache["plan"][index][field] = value
                        }
                    });
                } else if(layEvent === 'remind'){ //提醒时间
                    var field = $(this).data('field');
                    var index = tr.attr("data-index");
                    laydate.render({
                        elem: this.firstChild
                        ,type: 'datetime'
                        ,min: getNowFormatDate()
                        , done: function (value, date) {
                            table.cache["plan"][index][field] = value
                        }
                    });
                }else if (layEvent === 'del2') { //删除
                    var index = tr.attr("data-index");
                    obj.del(tr);
                }else if (layEvent === 'enclosure') {
                    idfile = $(this).find('button[name="butfile"]').attr('id');
                }else if(layEvent == 'fileNameBut'){
                    layer.confirm('确定删除该附件吗？', function (index) {
                        layer.msg('删除成功', {icon: 6, time: 1000});
                        // console.log(tablePlus)

                         index2 = tr.attr("data-index");
                        $('#fileName' + index2).html('');
                        tablePlus[0].attachmentName = ''
                        tablePlus[0].attachmentId = ''
                        tablePlus[0].LAY_TABLE_INDEX = parseInt(index2)+1
                        table.reload('plan')
                        // console.log(arr)
                        // $.ajax({
                        //     type: 'get',
                        //     url: '/delete?' + attUrl,
                        //     dataType: 'json',
                        //     success: function (res) {
                        //         if (res.flag == true) {
                        //             layer.msg('删除成功', {icon: 6, time: 1000});
                        //             console.log($(_this).parent())
                        //             console.log($(_this).html())
                        //             $(_this).parent().remove();
                        //         } else {
                        //             layer.msg('删除失败', {icon: 2, time: 1000});
                        //         }
                        //     }
                        // })
                    });

                }
            });

            function getNowFormatDate() {
                var date = new Date( );
                var seperator1 = "-";
                var seperator2 = ":";
                var month = date.getMonth() + 1;
                var strDate = date.getDate();
                if (month >= 1 && month <= 9) {
                    month = "0" + month;
                }
                if (strDate >= 0 && strDate <= 9) {
                    strDate = "0" + strDate;
                }
                var currentdate = date.getFullYear() + seperator1 + month + seperator1 + strDate
                    + " " + date.getHours() + seperator2 + date.getMinutes()
                    + seperator2 + date.getSeconds();
                return currentdate;
            }
        })

    })



</script>



</html>
